package com.leadbank.springboot.example.dal.domain;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created by hp on 2018/1/10.
 */
@Mapper
public interface UserMapper {

    @Select("SELECT * FROM USER WHERE id = #{id}")
    User findById(@Param("id") Long id);

    @Select("SELECT * FROM USER WHERE username = #{name}")
    User findByName(@Param("name") String name);

    @Insert("INSERT INTO USER(username, sex) VALUES(#{username}, #{sex})")
    int insert(@Param("username") String name, @Param("sex") String sex);

}
